package com.rms.service.impl;

import com.rms.entity.Cuisine;
import com.rms.mapper.CuisineMapper;
import com.rms.service.CuisineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 胡满意
 * @date 2019/10/31
 */
@Service
public class CuisienServiceImpl implements CuisineService {
    @Autowired
    private CuisineMapper cuisineMapper;
    @Override
    public  List<Cuisine> selectAll(){
        return cuisineMapper.selectAll();
    }
    @Override
    public Cuisine selectCuisine(String cuisineName){
        return cuisineMapper.selectCuisine(cuisineName);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertCuisine(String cuisineName){
        return cuisineMapper.insertCuisine(cuisineName);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateCuisine(int cuisineId,String cuisineName){
        return cuisineMapper.updateCuisine(cuisineId,cuisineName);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteCuisine(int cuisineId){
        return cuisineMapper.deleteCuisine(cuisineId);
    }
}
